
public class Java0809{
    // 简单的泛型方法示例
    public static <T> void printArray(T[] array) {
        for (T element : array) {
            System.out.print(element + " ");
        }
        System.out.println();
    }

    // 简单的泛型类示例
    public static class Box<T> {
        private T content;

        public void setContent(T content) {
            this.content = content;
        }

        public T getContent() {
            return content;
        }
    }

    public static void main(String[] args) {
        // 测试泛型方法
        Integer[] intArray = {1, 2, 3, 4, 5};
        String[] stringArray = {"Hello", "World", "Java"};

        System.out.println("整数数组:");
        printArray(intArray);

        System.out.println("字符串数组:");
        printArray(stringArray);

        // 测试泛型类
        Box<Integer> integerBox = new Box<>();
        integerBox.setContent(123);
        System.out.println("整数盒子内容: " + integerBox.getContent());

        Box<String> stringBox = new Box<>();
        stringBox.setContent("泛型测试");
        System.out.println("字符串盒子内容: " + stringBox.getContent());
    }
}